#ifndef CONNECTIONLINE_H
#define CONNECTIONLINE_H

#include <QGraphicsLineItem>
#include "NodeItemBase.h"
#include <QPainter>
#include <QTimer>
#include <QMenu>
#include <QGraphicsSceneContextMenuEvent>
#include <QGraphicsScene>
#include<QObject>
class ConnectionLine : public QObject, public QGraphicsLineItem
{
    Q_OBJECT
public:
    ConnectionLine(NodeItemBase* startNode, NodeItemBase* endNode, QGraphicsItem* parent = nullptr);

    void updatePosition();


protected:
    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override;

    void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);





private:
    NodeItemBase* m_start;
    NodeItemBase* m_end;
    QPolygonF arrowHead;

    QTimer* timer = nullptr;


};

#endif // CONNECTIONLINE_H
